package com.lianjia.sh.tools.config;
import com.lianjia.sh.tools.msg.v1.sender.FullWebSender;
import com.lianjia.sh.tools.msg.v1.sender.MailSender;
import com.lianjia.sh.tools.msg.v1.sender.PnsSender;
import com.lianjia.sh.tools.msg.v1.sender.SmsSender;
import com.lianjia.sh.tools.msg.v1.sender.impl.FullWebSenderImpl;
import com.lianjia.sh.tools.msg.v1.sender.impl.MailSenderImpl;
import com.lianjia.sh.tools.msg.v1.sender.impl.PnsSenderImpl;
import com.lianjia.sh.tools.msg.v1.sender.impl.SmsSenderImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Set;

/**
 * Created by yangsp1 on 16/6/24.
 */
@Configuration
public class SenderCfg {

    @Bean(name = {"pnsSender"})
    PnsSender pnsSender(){
        PnsSender pnsSender = new PnsSenderImpl();
        pnsSender.setPnsTextUrl("http://pns.dooioo.org/api/message/user/push?appId={appId}&businessId={businessId}&remark={remark}&prompt={prompt}&recipients={recipients}&touchdown={touchdown}");
        pnsSender.setPnsRichTextUrl("http://pns.dooioo.org/message/pushUserRichText?businessId={businessId}&richType={richType}&linkId={linkId}&recipients={recipients}&title={title}&subTitle={subTitle}&remark={remark}&time={time}");
        pnsSender.setPnsPicUrl("http://pns.dooioo.org/message/pushUserPic?picUrl={picUrl}&recipients={recipients}");
        return pnsSender;
    }

    @Bean(name = {"smsSender"})
    SmsSender smssender(){
        SmsSender smsSender = new SmsSenderImpl();
        smsSender.setSmsUrl("http://duanxin.dooioo.net/api/tools/sendMsg");
        return smsSender;
    }

    @Bean(name = {"fullWebSender"})
    FullWebSender fullWebSender(){
        FullWebSender fullWebSender = new FullWebSenderImpl();
        fullWebSender.setFullWebMsgUrl("http://xiaoxi.dooioo.net/api/message/save");
        return fullWebSender;
    }

    @Bean(name = {"mailSender"})
    MailSender mailSender(){
        MailSender mailSender = new MailSenderImpl();
        mailSender.setDefaultHost("smtp.163.com");
        mailSender.setDefaultFrom("flypigs1@163.com");
        mailSender.setDefaultPassword("oiazneqlvdywfrqu");
        return mailSender;
    }
}
